package cn.usian.jyzx.model.vo.common;

import lombok.Data;
import lombok.ToString;
import org.apache.poi.ss.formula.functions.T;

/**
 * @TODO:
 * @Author:baimu
 * @Date:2024 10 30 13 55
 **/

@Data
@ToString
public class Result<T> {

    private Integer code;
    private String message;
    private T data;



    public Result() {
    }

    public Result(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


    public static <T> Result<T> build(T data,Integer code,String message){

        Result<T> tResult = new Result<>();
        tResult.setCode(code);
        tResult.setMessage(message);
        tResult.setData(data);
        return tResult;

    }

    /**
     * 魔法值
     * @param data
     * @return
     * @param <T>
     */
    public static <T> Result<T> build(T data,ResultCodeEnum resultCodeEnum){
        return build(data, resultCodeEnum.getCode(), resultCodeEnum.getMessage());
    }



    //build(list,resultCodeEnum.)
}
